export const getInputs = () => [
	[
		[
			[1, 2, 3],
			[4, 5, 6],
			[7, 8, 9],
		],
	],
	[
		[
			[1, 2, 3, 4],
			[5, 6, 7, 8],
			[9, 10, 11, 12],
			[13, 14, 15, 16],
		],
	],
	[
		[
			[1, 2, 3, 4, 5],
			[6, 7, 8, 9, 10],
			[11, 12, 13, 14, 15],
			[16, 17, 18, 19, 20],
			[21, 22, 23, 24, 25],
		],
	],
];

/**
 * **[48. 旋转图像](https://leetcode.cn/problems/rotate-image/)**
 *
 * 给定一个 n × n 的二维矩阵 `matrix` 表示一个图像。请你将图像顺时针旋转 90 度。
 * 你必须在 [原地](https://baike.baidu.com/item/%E5%8E%9F%E5%9C%B0%E7%AE%97%E6%B3%95) 旋转图像，这意味着你需要直接修改输入的二维矩阵。**请不要** 使用另一个矩阵来旋转图像。
 *
 * @param matrix
 */
export default function (matrix: number[][]): void {
	const length = matrix.length;
	const halfLen = length / 2;
	for (let i = 0; i < halfLen; i++) {
		for (let j = 0; j < Math.floor(halfLen); j++) {
			let x = i,
				y = j;
			let nextVal = matrix[x][y];
			for (let times = 0; times < 4; times++) {
				[x, y] = [y, length - 1 - x];
				const targetVal = matrix[x][y];
				matrix[x][y] = nextVal;
				nextVal = targetVal;
			}
		}
	}

	console.log(matrix);
}
